﻿/** \file
* \$Rev: 184 $
* 
* \$Date: 2010-04-14 07:18:41 +0000 (Wed, 14 Apr 2010) $
*
* \$URL: http://chorus-twitter.googlecode.com/svn/trunk/src/net/StatusSource.cs $
*/

using System;
using chorus.twitter;

namespace chorus.net
{
	/// <summary>
	/// A source that fetches a list of statuses.
	/// </summary>
	public abstract class PagedStatusSource : XmlMessageSource<statuses>
	{
		/// <summary>The pagination parameters.</summary>
		public readonly PagedParameters pageparms = new PagedParameters();

		/// <summary>The path part of the source URI.</summary>
		public override string UriPath { get { return base.UriPath + "/statuses"; } }
	
		/// <summary>The constructor.</summary>
		public PagedStatusSource() { pageparms.Populate(qparams); }
	}

	/// <summary>
	/// A source that fetches statuses in the public timeline.
	/// </summary>
	public class StatusSource_Public : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "public_timeline"; } }
	}

	/// <summary>
	/// A source that fetches statuses from the authenticating user and their
	/// friends, including retweets. This is equivalent to what you see on the
	/// web by default.
	/// </summary>
	public class StatusSource_Home : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "home_timeline"; } }
	}

	/// <summary>
	/// A source that fetches statuses from the authenticating user and their
	/// friends.
	/// </summary>
	public class StatusSource_Friends : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "friends_timeline"; } }
	}

	/// <summary>
	/// A source that fetches statuses from the specified user.
	/// </summary>
	public class StatusSource_User : PagedStatusSource
	{
		/// <summary>The user ID parameters.</summary>
		public readonly UserIDParameters useridparms = new UserIDParameters();

		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "user_timeline"; } }

		/// <summary>The constructor. Sets up parameters.</summary>
		public StatusSource_User() { useridparms.Populate(qparams); }
	}

	/// <summary>
	/// A source that fetches statuses that mention the user.
	/// </summary>
	public class StatusSource_Mentions : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "mentions"; } }
	}

	/// <summary>
	/// A source for all statuses retweeted by the authenticating user.
	/// </summary>
	public class StatusSource_RetweetedByMe : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "retweeted_by_me"; } }
	}

	/// <summary>
	/// A source for all retweets sent to the authenticating user.
	/// </summary>
	public class StatusSource_RetweetedToMe : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "retweeted_to_me"; } }
	}

	/// <summary>
	/// A source for all of the authenticating user's statuses that have been retweeted.
	/// </summary>
	public class StatusSource_RetweetsOfMe : PagedStatusSource
	{
		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "retweets_of_me"; } }
	}



	/// <summary>
	/// A source that fetches a single status.
	/// </summary>
	public class StatusSource_ShowID : XmlSource<status>
	{
		/// <summary>The ID of the status to fetch.</summary>
		ulong id;

		/// <summary>The path part of the source URI.</summary>
		public override string UriPath { get { return base.UriPath + "/statuses"; } }

		/// <summary>The type part of the source URI.</summary>
		public override string UriType { get { return "show/" + id.ToString(); } }
	}
}
